<template>
    <div class="container" ref="container">
        <div class="ai-deal-list-tr" v-for="(item, index) in data" :key="index">
            <div class="ai-deal-list-imgs">
                <div class="el-image ad-deal-img">
                    <img :src="item.img" alt="" />
                </div>
            </div>
            <div class="ai-deal-list-info">
                <div class="ai-deal-type">{{ item.type }}</div>
                <div class="ai-deal-status">{{ item.status }}</div>
                <div class="ai-deal-name">
                    {{ item.name }}
                </div>
                <div class="ai-deal-time">{{ item.time }}</div>
            </div>
        </div>
        <div v-if="data.length === 0" class="ai-deal-list-tr no-list">
            <div class="no-list-item">暂无异常数据</div>
        </div>
    </div>
</template>

<script setup>

import { ref, onMounted} from 'vue';
const { data } = defineProps({
    data: {
        type: Array,
        default: () => []
    }
})

const container = ref(null);
const containerStyle = ref(null);

onMounted(() => {
    if (container.value) {
        containerStyle.value = window.getComputedStyle(container.value);
        container.value.style.top = container.value.getBoundingClientRect().height + 'px';
        setTimeout(() => {
            container.value.style.top = 0;
        }, 1000);
    }
});
</script>

<style scoped>
.container {
    position: absolute;
    /* top: 0; */
    width: 100%;
    /* transition: transform 0.1s linear; */
    transition: all 2s cubic-bezier(0.88, 1, 0.61, 1.48);
}

.ai-deal-list-tr {
    display: flex;
    width: 100%;
    align-items: center;
    margin-bottom: 0.5vw;
}

.ai-deal-list-imgs {
    width: 6.666667vw;
    height: 5.208333vw;
    margin-right: 0.520833vw;
}

.ai-deal-list-tr .ai-deal-type {
    line-height: 1.302083vw;
    font-size: 0.9375vw;
    font-weight: 500;
    color: #fff;
    text-align: left;
    margin-bottom: 0.104167vw;
}

.ai-deal-list-tr .ai-deal-status {
    width: 4.166667vw;
    height: 1.041667vw;
    line-height: 1.041667vw;
    background: rgba(0, 230, 182, 0.11);
    border-radius: 0.208333vw;
    border: 1px solid #fff;
    font-size: 0.729167vw;
    color: #fff;
    margin-bottom: 0.104167vw;
    text-align: center;
}

.ai-deal-list-tr .ai-deal-name {
    height: 1.041667vw;
    font-size: 0.7vw;
    color: #b2e2ff;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.ai-deal-list-tr .ai-deal-time {
    height: 1.041667vw;
    font-size: 0.729167vw;
    color: #b2e2ff;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.ai-deal-list-imgs {
    background-image: url("@/assets/itemSide.png");
    background-size: 100%;
}

.el-image.ad-deal-img {
    width: 100%;
    height: 100%;
}

.el-image.ad-deal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-deal-list-info {
    width: 67%;
    overflow: hidden;
}

.no-list {
    line-height: 1.25vw;
    font-size: 0.625vw;
    color: #eef8ff;
    text-align: center;
    margin-top: 1.2vw;
}

.no-list-item {
    text-align: center;
    width: 100%;
}
</style>